Skip to content

GitHub: the approval rule and blockers - #44

Merged
tomkaczocha merged 5 commits into
mainfrom
t3/factory-issue-13-1
Oct 15, 2026
Merged

tomkaczocha merged 5 commits into
mainfrom
t3/factory-issue-13-1

Conversation

@rawphp

@rawphp rawphp commented Oct 15, 2026 •

Copy link
Copy Markdown

Closes #13

Contract

  • done: makeGitHub gains approval, textCheck, textEditedSince, openBlockers and textBlockers, reading label events, renames and the body's edit history with softfac's approval GraphQL query byte for byte and the same gh argv; a pure dependsOn parser for the ## Depends on section; domain/approval.ts holds the Approval, Refusal and TextCheck types and the pure refusalReason and unapprovedComment with softfac's exact wording. softfac's tracker-level tests are ported.
  • out: claim, the start step, when to post the refusal comment and the second look (Pass loop: claim ready issues fairly #15, Start: launch the /factory session for a claimed issue #16); activity_since, mover, ready_by, pr_feedback; Linear; every upstream file.
  • settled (rawphp, 2026-10-15): tracker-level tests from src/github.rs instead of the runner "start:" sections; textCheck and textEditedSince ship here; the refusal comment is a pure domain function.
  • risk: none
  • test: vp test run apps/server/src/factory/tracker apps/server/src/factory/domain → pass (279 tests, 7 files)

Acceptance criteria

  • The approval rule: who applied the current factory:ready, then every body edit and title rename at or after that moment; same second counts as after; only User actors; logins match without regard to case; approved or one of the four fixed refusals — tracker/github.test.ts "approval reads the real shapes and sends one call", "an edit in the same second as the label counts as after it", "a rename in the same second as the label counts as after it", "a label applied by an actor that is not a user is refused whatever its login", "the instructor comparison ignores case", "a hundred events of a longer history without the label is incomplete"; wording in domain/approval.test.ts "is softfac's literal comment for an edit after the label" and "for a history that is too long".
  • Same GraphQL queries as softfac — tracker/approvalHistory.test.ts "the approval query is softfac's, byte for byte"; argv in the ported delegation tests ("makeGitHub approval sends one graphql call", "makeGitHub text check sends one graphql call per check").
  • Blockers: open blockedBy links; otherwise each #n and owner/repo#n under ## Depends on up to the next heading that is still open; an unreadable blocker is an error — tracker/github.test.ts "open blockers keep the repo they are in", "text blockers are the named issues that are not closed", "a named issue that cannot be read is an error, not a resolved blocker", "an open blocker whose repo is unknown is an error, not a guess"; domain/dependsOn.test.ts (the 13 depends_on_* cases).
  • Tests ported (as settled by the instructor): all approval_* and the rest of softfac's approval section, text_check_*, text_edited_since_*, the open_blockers block, text_blockers_*, depends_on_*, and the two "Issues impl for GitHub" delegation tests for approval and text_check. Not ported: unchanged_since_is_the_text_check_said_unchanged (its subject, unchanged_since, is not shipped); the other unchanged_since_* cases were ported as textCheck cases because they pin shared cut-off rules.

Gate

  • factory/scripts/check.sh → exit 0 (.factory/gate-1.log: seams clean; vp test run apps/server/src/factory 670 passed in 24 files; vp run --filter t3 typecheck 0 errors; vp run --filter @t3tools/web typecheck 0 errors)

Models

  • maker: claude-sonnet-5-5 (no models block in .dw/config.yml; Tom's roster)
  • checker: claude-opus-5-5
  • orchestrator: this session

Review

  • cycles: 2
  • cycle 1 (correctness, security, maintainability, read-only): correctness approved and confirmed the docs/issues.md prose asks nothing the code does differently; security approved; maintainability-1 (pure logic left in github.ts, file over 1k lines) → refactor: commit splitting tracker/approvalHistory.ts and domain/dependsOn.ts.
  • cycle 2 (testing, mutating, once): 12 named mutants, 11 killed, 1 survived (testing-1: openBlockers had no test for a state that is neither open nor closed) → test: commit pinning softfac's exact rule (only the lowercase closed resolves a blocker).
  • fixed: maintainability-1, testing-1
  • leftovers: testing-2 (nit, dropped): the pure functions in approvalHistory.ts are covered only through makeGitHub; all 11 kills came from those tests. github.ts is 1170 lines after the split; the remaining size is pre-existing gh calls this issue did not touch.

Notes

  • The worktree the factory launched was cut from a stale main; it was fast-forwarded to origin/main (465a1e5) at Isolate, clean tree.

  • No labels created: all seven factory:* labels exist on the repo.

  • Red phase verified: with the product files at the test: commit, 90 of the ported tests fail; all pass at the feat: tip.

  • Two differences from the Rust that the tests cannot see: an issue number above 2^53 in ## Depends on is skipped (JS safe integers), and the ## Depends on heading match uses toLowerCase(), which differs from eq_ignore_ascii_case only for non-ASCII headings.

  • The first gh pr create without --repo opened the draft on the fork's parent, GitHub: the approval rule and blockers pingdotgg/t3code#20040; it was closed within a minute with a comment and recreated here. Nothing else was written to the upstream repo.

Lessons

  • Do not prescribe timeout in a reviewer packet on macOS. Symptom: the mutating reviewer reports timeout is not installed and bounds each run by the tool's own limit instead. Cause: the packet's example command used GNU coreutils' timeout, which macOS lacks. Default: say "bounded by the tool's timeout" or give a portable form (perl -e 'alarm 120; exec @ARGV' -- …), and keep one mutant per command so a hang costs one call.
  • Check a size target against in-scope code before sending the finding to Make. Symptom: a maintainability finding asks for a file under 1,000 lines; the in-scope move lands at 1,170 because the rest is code the issue never touched. Cause: the reviewer's fix line named a number, and the maker reported a miss against it. Default: when a finding names a target the issue's own lines cannot reach, send the move and write the gap on the receipt instead of a second cycle.
  • In a fork, gh pr create needs --repo and --head. Symptom: the draft pull request opens on the upstream repository the fork was made from, not on the fork. Cause: gh resolves a fork's parent as the default repository for pull requests. Default: at Ship, always pass --repo <owner/repo from the issue> and --head <branch>, and read the URL back before linking or reporting it; if it names another repo, close it with a comment at once and recreate.

Commits

  • 34cd4d6c1 test(factory): port softfac's approval, text check and blocker tests — Make slice (red)
  • f82bda835 feat(factory): the approval rule, text checks and blockers over gh — Make slice (green; also a two-line lint fix in the ported tests)
  • 072e64cb0 refactor(factory): split the pure approval judgement and Depends on parser out of github.ts — Check cycle 1
  • f96097b2e test(factory): a blocker in a state other than the exact \closed` still blocks` — Check cycle 2

Files

  • apps/server/src/factory/tracker/github.ts — the five new gh-calling methods and Blocker
  • apps/server/src/factory/tracker/approvalHistory.ts — the approval query, GitHub's answer shape and the pure judgement over it
  • apps/server/src/factory/domain/approval.ts — Approval, Refusal, TextCheck, refusalReason, unapprovedComment
  • apps/server/src/factory/domain/dependsOn.ts — the ## Depends on parser
  • apps/server/src/factory/tracker/github.test.ts, tracker/approvalHistory.test.ts, domain/approval.test.ts, domain/dependsOn.test.ts — the ported tests

Issue: #13

Red: domain/approval.ts and the new github.ts exports do not exist yet.
…arser out of github.ts

Issue: #13
Addresses maintainability-1.
…ll blocks

Issue: #13
Pins the rule testing-1 found untested: openBlockers resolves a row only on
REST's exact lowercase `closed`, as softfac does. Passes at this tip.
@rawphp
rawphp marked this pull request as ready for review October 15, 2026 21:51
@rawphp

rawphp commented Oct 15, 2026

Copy link
Copy Markdown
Author

Factory gate: passed (attempt 1, run by the factory in a fresh checkout of the pull request's head f96097b merged with the base branch tip 9e349c7)

Command Exit Time
factory/scripts/check.sh 0 31.6 s

…val in pure code

- textBlockers resolves a named issue only on the exact REST state `closed`, as openBlockers does.
- textBlockers refuses a Depends on section naming more than MAX_DEPENDS_ON (100) issues before
  reading any of them, so an issue body cannot fan out into thousands of gh calls.
- dependsOn skips an owner or repo made only of dots, which would step out of the API path.
- The approval judgement and textEditedSince's decision move into pure judgeApproval and
  editedSince in approvalHistory.ts, with unit tests; github.ts only reads the history.
- The approval query's page sizes come from HISTORY_PAGE, and the two cut-off checks share isCutOff.
@rawphp

rawphp commented Oct 15, 2026

Copy link
Copy Markdown
Author

Factory gate: passed again (attempt 2, run by the factory in a fresh checkout of the pull request's head fcd513a merged with the base branch tip 9e349c7)

Command Exit Time
factory/scripts/check.sh 0 31.6 s

@tomkaczocha
tomkaczocha merged commit 88c871b into main Oct 15, 2026
@rawphp
rawphp deleted the t3/factory-issue-13-1 branch October 28, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub: the approval rule and blockers

2 participants